Loggest thine Stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

2 years ago
2 years ago
2 years ago
  1. <script lang="ts" context="module">
  2. import type { Load } from "@sveltejs/kit/types/internal";
  3. import { sl3 } from "$lib/clients/sl3";
  4. import type { ProjectEntry } from "$lib/models/project";
  5. export const load: Load = async({ fetch, params, stuff }) => {
  6. const scopeId = parseInt(params.scope.split("-")[0]);
  7. const client = sl3(fetch, stuff.idToken);
  8. const [scope, projects] = await Promise.all([
  9. client.findScope(scopeId),
  10. client.listProjects(scopeId),
  11. ]);
  12. return {
  13. props: { projects, scope },
  14. };
  15. }
  16. </script>
  17. <script lang="ts">
  18. import {page} from "$app/stores"
  19. import Columns from "$lib/components/layout/Columns.svelte";
  20. import Column from "$lib/components/layout/Column.svelte";
  21. import ScopeContext from "$lib/components/contexts/ScopeContext.svelte";
  22. import type Scope from "$lib/models/scope";
  23. import ProjectMenu from "$lib/components/scope/ProjectMenu.svelte";
  24. import ProjectListContext from "$lib/components/contexts/ProjectListContext.svelte";
  25. import ScopeMenu from "$lib/components/scope/ScopeMenu.svelte";
  26. import { scopePrettyId } from "$lib/utils/prettyIds";
  27. import ScopeHeader from "$lib/components/scope/ScopeHeader.svelte";
  28. export let scope: Scope;
  29. export let projects: ProjectEntry[];
  30. let hideMobile: boolean;
  31. $: hideMobile = $page.url.pathname !== `/${scopePrettyId(scope)}`
  32. </script>
  33. <svelte:head><title>{scope.abbreviation}: {$page.stuff.title} – Stufflog 3</title></svelte:head>
  34. <ScopeContext scope={scope}>
  35. <ProjectListContext projects={projects}>
  36. <Columns wide>
  37. <Column hideMobile={hideMobile} >
  38. <ScopeHeader />
  39. <ScopeMenu />
  40. <ProjectMenu />
  41. </Column>
  42. <Column span={4}>
  43. <slot></slot>
  44. </Column>
  45. </Columns>
  46. </ProjectListContext>
  47. </ScopeContext>